<div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true"><li class="fa fa-remove"></li></button>
    <h5 class="modal-title"></h5>
</div>

<div class="modal-body">
    <form id="mapsetting_form" name="mapsetting_form" class="form-horizontal">
        <input type="hidden" name="id">
        <input type="hidden" name="version">
        <input type="hidden" name="createDateTime" data-flag="date" data-format="yyyy-mm-dd hh:ii:ss">
        <input type="hidden" name="deleted" value="0">
        <input type='hidden' value="${CSRFToken}" id='csrftoken'>
        <div class="box-body">
            <div class="col-md-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">所属基地</label>
                    <div class="col-sm-8">
                        <input type="text" class="form-control" id="orgid" name="orgid" placeholder="请填写所属基地">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">缩放级别<span style="color:red">*</span></label>
                    <div class="col-sm-8">
                        <input type="text" class="form-control" id="zoom" name="zoom" placeholder="请填写缩放级别">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">中心点经度<span style="color:red">*</span></label>
                    <div class="col-sm-8">
                        <input type="text" class="form-control" id="lng" name="lng" placeholder="请填写中心点经度">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">中心点纬度<span style="color:red">*</span></label>
                    <div class="col-sm-8">
                        <input type="text" class="form-control" id="lat" name="lat" placeholder="请填写中心点纬度">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">中心点位置<span style="color:red">*</span></label>
                    <div class="col-sm-8">
                        <input type="text" class="form-control" id="address" name="address" placeholder="请填写中心点位置">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">预留参数一<span style="color:red">*</span></label>
                    <div class="col-sm-8">
                        <input type="text" class="form-control" id="argOne" name="argOne" placeholder="请填写预留参数一">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">预留参数二<span style="color:red">*</span></label>
                    <div class="col-sm-8">
                        <input type="text" class="form-control" id="argTwo" name="argTwo" placeholder="请填写预留参数二">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">备注 <span style="color:red">*</span></label>
                    <div class="col-sm-8">
                        <input type="text" class="form-control" id="remark" name="remark" placeholder="请填写备注 ">
                    </div>
                </div>
            </div>
        </div>
        <div class="box-footer text-right">
            <button type="button" class="btn btn-default" data-btn-type="cancel" data-dismiss="modal">取消</button>
            <button type="submit" class="btn btn-primary" data-btn-type="save">提交</button>
        </div>
    </form>
</div>
<script>
    var form;
    var id="${id?default(0)}";
    $(function(){
        //初始化表单
        form=$("#mapsetting_form").form();
        //数据校验
        $("#mapsetting_form").bootstrapValidator({
            message : '请输入有效值',
            feedbackIcons : {
                valid : 'glyphicon glyphicon-ok',
                invalid : 'glyphicon glyphicon-remove',
                validating : 'glyphicon glyphicon-refresh'
            },
            submitHandler : function() {
                modals.confirm('确认保存？', function() {
                    var mapsetting = form.getFormSimpleData();
                    ajaxPost(basePath+'/mapsetting/save',mapsetting, function(data) {
                        if(data.success){
                            if(id!="0"){
                                modals.hideWin(winId);
                                mapsettingTable.reloadRowData(id);
                            }else{
                                modals.hideWin(winId);
                                mapsettingTable.reloadData();
                            }
                        }
                    });
                });
            },
            fields : {
                "zoom":{
                    validators:{
                        notEmpty:{message:'缩放级别不能为空'}
                    }
                },
                "lng":{
                    validators:{
                        notEmpty:{message:'中心点经度不能为空'}
                    }
                },
                "lat":{
                    validators:{
                        notEmpty:{message:'中心点纬度不能为空'}
                    }
                },
                "address":{
                    validators:{
                        notEmpty:{message:'中心点位置不能为空'}
                    }
                },
                "argOne":{
                    validators:{
                        notEmpty:{message:'预留参数一不能为空'}
                    }
                },
                "argTwo":{
                    validators:{
                        notEmpty:{message:'预留参数二不能为空'}
                    }
                },
                "remark":{
                    validators:{
                        notEmpty:{message:'备注 不能为空'}
                    }
                }
            }
        });
        //初始化控件
        form.initComponent();
        //编辑回填
        if(id!=0){
            ajaxPost(basePath+"/mapsetting/get/"+id,null,function(data){
                form.initFormData(data);
            })
        }
    });

</script>
